package com.pgeg.listener;

import com.pgeg.registry.ItemGroupRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.item.AliasedBlockItem;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.FoodComponents;
import net.minecraft.item.Item;

public class FoodListener {
    /*Foods*/
    public static final Item RICE = genCropFoodSettings(CropListener.RICE_CROP, FoodComponents.POTATO);
    public static final Item TOMATO = genCropFoodSettings(CropListener.TOMATO_CROP, FoodComponents.POTATO);
    public static final Item APPLE_PIE = genSettings(FoodComponents.APPLE);
    public static final Item BERRY_JELLY = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item BERRY_PIE = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item BURRITO_BEEF = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item DOUGH = genSettings(FoodComponents.BEETROOT);
    public static final Item CHEESE = genSettings(FoodComponents.COOKED_COD);
    public static final Item BURRITO_FISH = genSettings(FoodComponents.COOKED_COD);
    public static final Item BURRITO_VEGGIE = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item CARAMEL = genSettings(FoodComponents.APPLE);
    public static final Item BERRY = genSettings(FoodComponents.APPLE);
    public static final Item CARAMEL_DONUT = genSettings(FoodComponents.APPLE);
    public static final Item CHEESE_FRIES = genSettings(FoodComponents.COOKED_MUTTON);
    public static final Item CHOCOLATE_PIE = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item COOKIE_CAT = genSettings(FoodComponents.COOKIE);
    public static final Item CREAM_COOKIE = genSettings(FoodComponents.COOKIE);
    public static final Item LION_LICKER = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item NIGIRI_COD = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item NIGIRI_SALMON = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item NIGIRI_SQUID = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item NIGIRI_TROPICAL = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item ONIGIRI = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item ROLL_SEA_PICKLE = genSettings(FoodComponents.COOKED_MUTTON);
    public static final Item SLIME_PIE = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item SQUID_COOKED = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item SUGAR_DONUT = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item CARAMEL_APPLE = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item SQUID_RAW = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item MANA_CAKE = genSettings(FoodComponents.ENCHANTED_GOLDEN_APPLE);
    public static final Item BURGER_BEAN = genSettings(FoodComponents.BREAD);
    public static final Item CHRISTMAS_PUDDING = genSettings(FoodComponents.BREAD);
    public static final Item FRUITCAKE = genSettings(FoodComponents.BREAD);

    public static final Item NACHOS_CHEESE = genSettings(FoodComponents.BREAD);
    public static final Item TOFU = genSettings(FoodComponents.BREAD);
    public static final Item BACON = genSettings(FoodComponents.PORKCHOP);
    public static final Item BACON_AND_EGG = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item COOKED_BACON = genSettings(FoodComponents.COOKED_PORKCHOP);
    public static final Item FIRED_EGG = genSettings(FoodComponents.DRIED_KELP);
    public static final Item BEETROOT_NOODLES = genSettings(FoodComponents.BREAD);
    public static final Item BAT_WING = genSettings(FoodComponents.DRIED_KELP);
    public static final Item BLAZE_CREAM = genSettings(FoodComponents.COOKED_MUTTON);
    public static final Item CACTUS_FRUIT = genSettings(FoodComponents.APPLE);
    public static final Item CARROT_PIE = genSettings(FoodComponents.PUMPKIN_PIE);
    public static final Item CARROT_SEED_SOUP = genSettings(FoodComponents.BREAD);
    public static final Item STARVING_FRUIT = genSettings(FoodComponents.GOLDEN_APPLE);
    public static final Item SPIDER_SOUP = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item NETHER_WART_SOUP = genSettings(FoodComponents.COOKED_CHICKEN);
    public static final Item COOKED_BAT_WING = genSettings(FoodComponents.COOKED_PORKCHOP);
    public static final Item HORSE_MEAT = genSettings(FoodComponents.BEEF);
    public static final Item COOKED_HORSE_MEAT = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item LLAMA_MEAT = genSettings(FoodComponents.BEEF);
    public static final Item COOKED_LLAMA_MEAT = genSettings(FoodComponents.COOKED_BEEF);
    public static final Item WOLF_MEAT = genSettings(FoodComponents.BEEF);
    public static final Item COOKED_WOLF_MEAT = genSettings(FoodComponents.COOKED_BEEF);

    private static Item genSettings(FoodComponent component) {
        return new Item(new FabricItemSettings().group(ItemGroupRegistry.FOOD_GROUP).food(component));
    }

    private static Item genCropFoodSettings(Block block, FoodComponent component) {
        return new AliasedBlockItem(block, (new FabricItemSettings().group(ItemGroupRegistry.FOOD_GROUP).food(component)));
    }
}
